<template>
    <div>
        <!-- 顶部 -->
        <div class="sidebar_top">
            <div>性格测试管理</div>
            <!-- <div>退出</div> -->
        </div>
        <div class="sidbar_cont" >
            <!-- select菜单激活回调 -->
            <el-menu :default-active = "ac_index" @select="Select">
                <el-menu-item index="1" @click="$router.replace('/student')">学生个人查询</el-menu-item>
                <el-menu-item index="2" @click="$router.replace('/class')">班级学生查询</el-menu-item>
                <el-menu-item index="3" @click="$router.replace('/add_student')">添加学生账号</el-menu-item>
                <el-menu-item index="4" @click="$router.replace('/view_student')">学生个人可视化</el-menu-item>
                <el-menu-item index="5" @click="$router.replace('/view_class')">班级可视化</el-menu-item>
            </el-menu>
        </div>
        <router-view></router-view>
    </div>
  
</template>

<script>
import {useRouter} from 'vue-router'
import { ref, onMounted } from "vue";
export default{
    setup(){
        const router = useRouter()
        const ac_index = ref('1')
        //菜单激活回调
        function Select(index, path){
            localStorage.setItem('menuid', JSON.stringify(index))

        }
        onMounted(()=>{
            ac_index.value = JSON.parse(localStorage.getItem('menuid'))
        })

        

        return{ac_index, Select}
    }
}
</script>

<style></style>


